Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Devtools] Ensure initial read of useFormStatus returns NotPendingTransition #28728

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Apr 3, 2024

Closes #29788

Stack:

  1. DevTools: Rely on sourcemaps to compute hook name of built-in hooks in newer versions #28593
  2. Devtools: Add support for useFormStatus #28413
  3. [Devtools] Ensure initial read of useFormStatus returns NotPendingTransition #28728 <--- You're here

Summary

We couldn't initialize the HostTransitionContext to NotPendingTransition since that created a dependency cycle. By moving the whole HostTransitionContext into the Fiber config, we no longer have a dependency cycle and can initialize the context to the config specific NotPendingTransition value.

Flow should ensure every Fiber config implements HostTransitionContext properly. It's just a bit annoying since it duplicates config boilerplate.

An incorrect initial value in Devtools would be bad since it probably makes any component not inspectable if you destructure the form status i.e. const {isPending} = useFormStatus() since you'd try to destructure null when we inspect the component.

@react-sizebot
Copy link

react-sizebot commented Apr 3, 2024

Comparing: a7d1240...a3c2f2f

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 500.39 kB 500.37 kB +0.02% 89.78 kB 89.80 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 507.52 kB 507.50 kB +0.01% 90.95 kB 90.96 kB
facebook-www/ReactDOM-prod.classic.js = 595.41 kB 595.40 kB +0.02% 105.58 kB 105.60 kB
facebook-www/ReactDOM-prod.modern.js = 571.71 kB 571.70 kB +0.02% 101.78 kB 101.80 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against f117368

@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from c4c315f to 592eb8b Compare April 3, 2024 20:03
@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from 592eb8b to fa7c1dd Compare April 15, 2024 21:14
@eps1lon eps1lon requested a review from acdlite April 15, 2024 21:20
@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from ffc4b05 to 9261a50 Compare July 31, 2024 16:50
Copy link

vercel bot commented Jul 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 4:54pm

@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from 9261a50 to f117368 Compare July 31, 2024 16:52
@eps1lon eps1lon merged commit 88ee14f into facebook:main Aug 1, 2024
185 checks passed
@eps1lon eps1lon deleted the formstatus-no-transition-config branch August 1, 2024 08:56
github-actions bot pushed a commit that referenced this pull request Aug 1, 2024
github-actions bot pushed a commit that referenced this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team React 19
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DevTools Bug]: Null destructuring error inspecting a component with useFormStatus
4 participants